// RegularPolygonColumnWithHole.cpp: implementation of the RegularPolygonColumnWithHole class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "RegularPolygonColumnWithHole.h"
#include "UECone.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

RegularPolygonColumnWithHole::RegularPolygonColumnWithHole( int nEdge ) : RegularPolygonColumn( nEdge )
{
}

RegularPolygonColumnWithHole::~RegularPolygonColumnWithHole()
{

}

AcDb3dSolid* RegularPolygonColumnWithHole::Create()
{
	AcDb3dSolid* pSld1 = RegularPolygonColumn::Create();
	if ( pSld1 == 0 ) return 0;

	CUECone cone( Position(), ZAxis(), m_InnerRadius, m_InnerRadius, Height()  );
	AcDb3dSolid* pSld2 = cone.Create();
	if ( pSld2 == 0 ) {
		delete pSld1;
		return 0; }

	Acad::ErrorStatus es = pSld1->booleanOper ( AcDb::kBoolSubtract, pSld2 );
	if ( es != Acad::eOk ) {
		delete pSld1;
		delete pSld2;
		return 0; }

	delete pSld2;
	return pSld1;
}
